package cn.webrx.chat;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) {
        try {
            Socket s = new Socket("127.0.0.1", 6666);
            BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
            PrintWriter out = new PrintWriter(s.getOutputStream());
            while (true) {
                System.out.println("ok------------------");
                String sss = (new Scanner(System.in)).nextLine();
                out.write(sss + "\r\n");
                out.flush();
                System.out.println(br.readLine());
            }
        } catch (Exception e) {
            System.out.println(e.toString());
        }
    }
}
